import Vue from 'vue'
import App from './App.vue'
import router from '@/router'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import axios from 'axios'
import { Loading } from 'element-ui'
import format from '@/assets/js/date.js'

Vue.config.productionTip = false

Vue.use(ElementUI);

//全局配置
// axios.defaults.baseURL = '请求根路径'
Vue.prototype.axios = axios

// 发起axios请求时loading效果(请求拦截)
let loadingInstance = null
axios.interceptors.request.use(config => {
  loadingInstance = Loading.service({ fullscreen: true})
  return config
})

// 关闭loading效果(响应拦截)
axios.interceptors.response.use(response =>{
  loadingInstance.close()
  return response
})
new Vue({
  render: h => h(App),
  router
}).$mount('#app')
